package com.ep.thirdPlatformProject.oa.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.ep.thirdPlatformProject.oa.entity.OACompanyEntity;
import com.ep.thirdPlatformProject.oa.entity.vo.OACompanyVO;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
@DS("oa_db")
public interface OACompanyMapper extends MPJBaseMapper<OACompanyEntity> {


    /**
     * 通过映射公司编码获得公司id
     *
     * @return {@link OACompanyVO }
     */
    @Select({
            " select a.ysgs as reflectCompanyCode,b.subcompanyname,b.id " +
            " from HrmSubcompanyDefined a left join HrmSubcompany b on a.subcomid = b.id where a.ysgs <>'' " +
            " and a.ysgs =#{code}  "})
    OACompanyVO getOACompanyByReflectCode(@Param("code") String code);
}
